package xp2p.svc;

public abstract class BeatBase extends ServiceBase
{
	private long lifetime = 60000; // 1 minute

	@Override
	protected void doRun() throws InterruptedException
	{
		while (true)
		{
			if (getExit())
			{
				return;
			}
			beat();
			Thread.sleep(lifetime);
		}

	}

	protected abstract void beat();

	public long getLifetime()
	{
		return lifetime;
	}

	public void setLifetime(long lifetime)
	{
		this.lifetime = lifetime;
	}
}
